<style lang="less">
  .item1{
    height: 42px;
    line-height: 40px;
  }
  .row-left{
    text-align: center;
  }
  .title-top{
    margin-bottom:10px;
    color: #1C86EE;
    font-size: 1rem;
    border-bottom: 1px solid orangered;
    font-size: 20px;
    color: coral;
  }
  .content-submit{
    background-color:white;
    height: auto;
  }
  .idCard{
    width: 170px;
    height: 80px;
    background-color: #79e428;
    position: absolute;
    right: 2%;
    top: 13%;
    color: white;
    font-size: 1.5rem;
    line-height: 80px;
    text-align: center;
  }
  .red-name{
    color: red
  }
  .ivu-steps-item {
    display: initial;
    position: relative;
    vertical-align: initial;
  }
  .step-item {
    float: left;
    margin-left: 0px;
  }
</style>
<template>
  <div style="background-color:white">
    <div style="">
      <Row class="title-top">
        <Col span="4" style="text-align: left;width:22%">城市低保救助申请登记</Col>
      </Row>
    </div>
    <div style="height:30px">
      <Steps :current="10" size="small">
        <div @click="nextStep('0')" class="step-item">
          <Step title="家庭信息" content=""></Step>
        </div>
        <div @click="nextStep('1')" class="step-item">
          <Step title="家庭成员" content=""></Step>
        </div>
        <div @click="nextStep('2')" class="step-item">
          <Step title="基础收入" content=""></Step>
        </div>
        <div @click="nextStep('3')" class="step-item">
          <Step title="基础支出" content=""></Step>
        </div>
        <div @click="nextStep('4')" class="step-item">
          <Step title="赡抚扶养" content=""></Step>
        </div>
        <div @click="nextStep('5')" class="step-item">
          <Step title="基础财产" content=""></Step>
        </div>
        <div @click="nextStep('6')" class="step-item">
          <Step title="财产房产" content=""></Step>
        </div>
        <div @click="nextStep('7')" class="step-item">
          <Step title="工作单位" content=""></Step>
        </div>
        <div @click="nextStep('8')" class="step-item">
          <Step title="教育情况" content=""></Step>
        </div>
        <div @click="nextStep('9')" class="step-item">
          <Step title="家庭附件" content=""></Step>
        </div>
        <div @click="nextStep('10')" class="step-item">
          <Step title="提交信息" content=""></Step>
        </div>
      </Steps>
    </div>
    <div class="content-submit">
      <Form ref="paramData" :model="paramData" :rules="ruleValidate">
            <Row class="item1">
              <Col span="15" offset="1" style="text-align: center" class="red-name">该页面信息填写，点击“完成”按钮后数据将直接提报到社会救助系统，无法在全市通办再进行信息修改！！！</Col>
            </Row>
            <Row class="item1">
              <Col span="5" style="text-align: center" class="red-name">开户银行名称代码:</Col>
              <Col span="6">
                <Select v-model="paramData.ssca0009">
                  <Option :value="obj.key" v-for="obj in data3" v-bind:key="obj.key">{{obj.value}}</Option>
                </Select>
              </Col>
              <Col span="5" style="text-align: center" class="red-name">开户银行账户:</Col>
              <Col span="6">
                <Input v-model="paramData.ssca0010" placeholder="持卡人姓名"></Input>
              </Col>
            </Row>
            <Row class="item1">
              <Col span="5" style="text-align: center" class="red-name">开户银行账号:</Col>
              <Col span="6">
                <Input v-model="paramData.ssca0011" placeholder="银行卡号"></Input>
              </Col>
              <Col span="5" style="text-align: center" class="red-name">致贫原因:</Col>
              <Col span="6">
                <Select v-model="paramData.ssca0013">
                  <Option :value="obj.key" v-for="obj in data2.PoorReasonDict" v-bind:key="obj.key">{{obj.value}}</Option>
                </Select>
              </Col>
            </Row>
            <Row class="item1" style="height: 55px;line-height: 55px" v-if="itemid == '11210101000000MZJD5212000330000'">
              <Col span="5" style="text-align: center" class="red-name">救助申请理由:</Col>
              <Col span="6">
                <Input v-model="paramData.ssca0008" type="textarea" :autosize="{minRows: 2,maxRows: 5}" />
              </Col>
            </Row>
            <Row class="item1" style="height: 55px;line-height: 55px" v-if="itemid == '11210101000000MZJD5212000351000'">
              <Col span="5" style="text-align: center" class="red-name">救助变更理由:</Col>
              <Col span="6">
                <Input v-model="paramData.ssca0034" type="textarea" :autosize="{minRows: 2,maxRows: 5}" />
              </Col>
            </Row>
          </Form>
    </div>
    <div style="height:40px;line-height:40px;float:left;margin-top:10px;margin-left:40%">
      <Button type="info" @click="complete()" :disabled="order_state == '1' || order_state == '2' || order_state == '3'">完成</Button>
    </div>
  </div>
</template>
<script>
import { getAppraising, createPostNew } from '@/api/eventlist'
export default {
  data () {
    return {
      flow: '',
      query_attachment_url: '',
      family_url: '',
      support_id: '',
      family_idInfo: {},
      next_params: {},
      itemid: this.$route.params.itemid || '',
      attachment_url: '',
      info_url: '',
      add_url: '',
      update_url: '',
      delete_url: '',
      see: this.$route.params.see || false,
      code: this.$route.params.code,
      url: '',
      str: this.$route.params.serialNumber,
      idcardNumber: this.$route.params.idcardNumber,
      ss11001Id: this.$route.params.ss11001Id,
      ss11002Id: this.$route.params.ss11002Id,
      paramData: {
        ss11001Id: this.$route.params.ss11001Id,
        ssca0009: '',
        ssca0010: '',
        ssca0011: '',
        ssca0013: '',
        ssca0008: '',
        ssca0034: '',
        ss17001Id: this.$route.params.ss17001Id
      },
      ruleValidate: {
        name: [
          { required: true, message: 'The name cannot be empty', trigger: 'blur' }
        ]
      },
      data1: [],
      data2: [],
      data3: [],
      modal: false,
      errorTitle: '保存错误',
      order_state: this.$route.params.order_state
    }
  },
  methods: {
    nextStep (step) {
      if (step === '0') {
        this.$router.push({
          name: 'subsistenceapplication',
          params: this.next_params
        })
      } else if (step === '1') {
        this.$router.push({
          name: 'subsistenceapplication1',
          params: this.next_params
        })
      } else if (step === '2') {
        this.$router.push({
          name: 'subsistenceapplication2',
          params: this.next_params
        })
      } else if (step === '3') {
        this.$router.push({
          name: 'expenditurelist',
          params: this.next_params
        })
      } else if (step === '4') {
        this.$router.push({
          name: 'supportlist',
          params: this.next_params
        })
      } else if (step === '5') {
        this.$router.push({
          name: 'basicproperty',
          params: this.next_params
        })
      } else if (step === '7') {
        this.$router.push({
          name: 'workunit',
          params: this.next_params
        })
      } else if (step === '8') {
        this.$router.push({
          name: 'educationinfo',
          params: this.next_params
        })
      } else if (step === '9') {
        this.$router.push({
          name: 'nearfamily',
          params: this.next_params
        })
      }
    },
    // 开户行数据
    getBankList () {
      var param1 = {
        'request_map': {
          'ss11001Id': this.$route.params.ss11001Id || this.$route.params.ss17001Id
        },
        'headers_map': {
          'serialNumber': this.str,
          'idcardNumber': this.idcardNumber
        },
        'url': 'dbsq/getBankDict'
      }
      createPostNew(param1).then(res => {
        this.data3 = res.data.data.data.BankCategoryDict
        console.log(res, '开户行数据')
        // console.log(this.data3)
      })
    },
    // 获取数据字典数据
    getInfo () {
      var param = {
        'idcardNumber': this.idcardNumber,
        'dictsCode': 'ss12001',
        'serialNumber': this.str
      }
      getAppraising(param).then(res => {
        this.data2 = res.data.data.data
        console.log(res, '通用字典数据')
        console.log(this.data2)
      })
    },
    getAssistanceInfo () {
      var param = {
        'request_map': {
          'ss17001Id': this.$route.params.ss17001Id
        },
        'headers_map': {
          'serialNumber': this.str,
          'idcardNumber': this.idcardNumber
        },
        'url': 'dbbg/getAssistanceInfo'
      }
      createPostNew(param).then(res => {
        console.log(res, '@@@@@@')
        this.paramData = res.data.data.data
        this.paramData.ss17001Id = this.$route.params.ss17001Id
        // this.$Message.success(res.data.data.memo)
      })
    },
    complete () {
      if (this.paramData.ssca0009 === '' || this.paramData.ssca0009 === undefined) {
        const content = '<p>开户银行名称代码不能为空</p>'
        this.$Modal.error({
          title: this.errorTitle,
          content: content
        })
        return
      }
      if (this.paramData.ssca0010 === '' || this.paramData.ssca0010 === undefined) {
        const content = '<p>开户银行账户不能为空</p>'
        this.$Modal.error({
          title: this.errorTitle,
          content: content
        })
        return
      }
      if (this.paramData.ssca0011 === '' || this.paramData.ssca0011 === undefined) {
        const content = '<p>开户银行账号不能为空</p>'
        this.$Modal.error({
          title: this.errorTitle,
          content: content
        })
        return
      }
      if (this.paramData.ssca0013 === '' || this.paramData.ssca0013 === undefined) {
        const content = '<p>致贫原因不能为空</p>'
        this.$Modal.error({
          title: this.errorTitle,
          content: content
        })
        return
      }
      if (this.itemid === '11210101000000MZJD5212000330000') {
        if (this.paramData.ssca0008 === '' || this.paramData.ssca0008 === undefined) {
          const content = '<p>救助申请理由不能为空</p>'
          this.$Modal.error({
            title: this.errorTitle,
            content: content
          })
          return
        }
      } else if (this.itemid === '11210101000000MZJD5212000351000') {
        if (this.paramData.ssca0034 === '' || this.paramData.ssca0034 === undefined) {
          const content = '<p>救助变更理由不能为空</p>'
          this.$Modal.error({
            title: this.errorTitle,
            content: content
          })
          return
        }
      }
      var param1 = {
        'request_map': this.paramData,
        'headers_map': {
          'serialNumber': this.str,
          'idcardNumber': this.idcardNumber
        },
        'url': this.url,
        'code': this.$route.params.code,
        'request_step': '11',
        'flow': this.flow
      }
      createPostNew(param1).then(res => {
        console.log(res.data.data.rescode)
        console.log(res.data.errcode)
        if (res.data.errcode === 0 && res.data.data.rescode === '0000') {
          const title = '申请成功'
          const content = '<p>该申请已经提交到低保系统,请等待审核</p>'
          this.$Modal.success({
            title: title,
            content: content,
            onOk: () => {
              console.log('chenggong')
              this.$router.push({
                name: 'mainv3',
                params: {
                  serialNumber: this.$route.params.serialNumber,
                  idcardNumber: this.$route.params.idcardNumber
                  // ss11001Id: this.$route.params.ss11001Id,
                  // ss11002Id: this.$route.params.ss11002Id
                }
              })
            }
          })
        } else {
          this.$Notice.error({ title: '', desc: res.data.data.memo })
        }
      })
    }
  },
  mounted () {
    if (this.itemid === '11210101000000MZJD5212000330000') {
      this.family_idInfo = {
        'ss11001Id': this.$route.params.ss11001Id
      }
      this.flow = '1'
      this.url = 'dbsq/submitAssistanceInfo'
      this.family_url = 'dbsq/queryPersonInfo'
      this.attachment_url = 'dbsq/queryAttachmentConfigs'
      this.query_attachment_url = 'dbsq/queryAttachmentDatas'
      this.delete_url = 'dbsq/delAttachmentData'
      // this.sq_id = 'dbsq/getSqFamilyDicts'
      this.next_params = {
        serialNumber: this.$route.params.serialNumber,
        idcardNumber: this.$route.params.idcardNumber,
        ss11001Id: this.$route.params.ss11001Id,
        ss11002Id: this.$route.params.ss11002Id,
        code: this.$route.params.code,
        see: this.see,
        itemid: this.itemid,
        order_state: this.order_state
      }
    } else if (this.itemid === '11210101000000MZJD5212000351000') {
      this.family_idInfo = {
        'ss17001Id': this.$route.params.ss17001Id
      }
      this.flow = '2'
      this.url = 'dbbg/submitAssistanceInfo'
      this.family_url = 'dbbg/queryPersonInfo'
      this.attachment_url = 'dbbg/queryAttachmentConfigs'
      this.query_attachment_url = 'dbbg/queryAttachmentDatas'
      this.delete_url = 'dbbg/delAttachmentData'
      // this.sq_id = 'dbbg/getSqFamilyDicts'
      this.next_params = {
        serialNumber: this.$route.params.serialNumber,
        idcardNumber: this.$route.params.idcardNumber,
        ss17001Id: this.$route.params.ss17001Id,
        ss17002Id: this.$route.params.ss17002Id,
        code: this.$route.params.code,
        see: this.see,
        itemid: this.itemid,
        order_state: this.order_state
      }
      this.getAssistanceInfo()
    }
    // 列表
    this.getBankList()
    this.getInfo()
  }
}
</script>
